<template>
    <div>
        <van-nav-bar
        :title="this.$route.query.adds"
        left-text="返回"
        left-arrow
        v-model="chosenAddressId"
        @click-left="onClickLeft"
        />
        <van-address-list
            :list="addressData"
            @add="onAdd"
            @edit="onEdit"
            />
            <van-popup v-model="show" round position="bottom" :style="{ height: '40%' }" >
                <!-- <van-cell-group>
                    <van-field v-model="from.name" label="姓名" />
                    <van-field v-model="from.tel" type="tel" label="手机号" />
                    <van-field v-model="from.address" label="地址" />
                    </van-cell-group>
                    <van-button block type="danger" round>提交</van-button> -->
            </van-popup>
    </div>
</template>
<script>
import {mapState,mapActions} from "vuex"
export default {
    data() {
    return {
        chosenAddressId:1,
        list: [],
        show:false
    };
    },
    computed:{
        ...mapState(['addressData']),
    },
    created(){
        this.getAddress()
    },
    methods:{
        ...mapActions(['getAddress']),
        
        onClickLeft() {
            this.$router.back()
        },
        onAdd() {
            this.$router.push('/addaddress')
        },
        onEdit(index) {
            this.show=!this.show
            console.log(index)
        },
    }
}
</script>